package pars;

public class ICGrammar {
	public static final String Rules = 
			/* Class Declarations */
			"S -> Program \n" + 
					
			"Program -> ClassPump\n" +

			"ClassPump -> ClassDecl ClassPump | \n" + 
			
			"ClassDecl -> class CLASS_ID ExtendsOptional { ClassBodyPump } \n" + 
			
			"ExtendsOptional -> extends CLASS_ID | \n" + 
			
			"ClassBodyPump -> Field ClassBodyPump | Method ClassBodyPump | \n" + 
			
			"Field -> Type ID VarConcat ;\n" + 
			
			"VarConcat -> , ID VarConcat | \n" +
			
			"Method -> StaticOptional FunctionReturnType ID ( Formals ) { StmtPump } \n" + 
			
			"StaticOptional -> static | \n" + 
			
			"FunctionReturnType -> Type | void\n" + 
			
			"Formals -> Type ID TypeConcat | \n" + 
			
			"TypeConcat -> , Type ID TypeConcat | \n" +
			
			"Type -> int | boolean | string | CLASS_ID | Type [ ]\n" + 

			
			/* Expressions */ 
			
			"Expr -> OR \n" + 
			
			"OR -> OR || AND | AND \n" + 
			
			"AND -> AND && IEQ | IEQ \n" + 
			
			"IEQ -> IEQ == INEQ | IEQ != INEQ | INEQ \n" + 
			
			"INEQ -> INEQ < AddSub | INEQ <= AddSub | INEQ > AddSub | INEQ >= AddSub | AddSub \n" + 
			
			"AddSub -> AddSub + MDR | AddSub - MDR | MDR \n" + 
			
			"MDR -> MDR / UnOp | MDR * UnOp | MDR % UnOp | UnOp \n" + 
			
			"UnOp -> UnSymbolPump UnSymbol NewExpr | NewExpr \n" + 
			
			"UnSymbolPump -> UnSymbolPump UnSymbol | \n" + 
			
			"UnSymbol -> ! | - \n" + 
			
			"NewExpr -> new CLASS_ID ( ) | new Type [ Expr ] | FinExpr \n" +  
			
			"FinExpr -> ( Expr ) | TermExpr \n" + 
			
			"TermExpr -> Call | Literal | this | FinExpr . length | Location  \n" +
			
			/* Statements */ 
			
			"StmtPump -> Stmt StmtPump | \n" + 
			
			"Stmt ->  NonIfStmt | IfStmt \n" + 
			
			"NonIfStmt -> RET | WithOutExpr  | StmtBlock | NewVar | Assignment | LOOP\n" +
			
			"StmtBlock -> { StmtPump }\n" + 
			
			"RET -> return ; | return Expr ;\n" + 
			
			"WithOutExpr -> Call ; | break ; | continue ;\n" + 
			
			"NewVar -> Type ID ; | Type ID = Expr ; \n" + 
			
			"Assignment -> Location = Expr ; \n" + 
			
			"LOOP -> while ( Expr ) Stmt \n" + 
			
			"IfStmt -> if ( Expr ) Stmt | IfElseStmt\n" + 
			
			"IfElseStmt -> if ( Expr ) IfElsePump else Stmt \n" + 
			
			"IfElsePump -> if ( Expr ) IfElsePump else Stmt | NonIfStmt \n" + 
			
			/* Methods */
			
			"Call -> StaticCall | VirtualCall \n" + 
			
			"StaticCall -> CLASS_ID . ID ( ExprOptional ) \n" + 
			
			"VirtualCall -> NewExpr . ID ( ExprOptional ) | ID ( ExprOptional ) \n" + 
			
			"ExprOptional -> Expr ExprConcat | \n" + 
			
			"ExprConcat -> , Expr ExprConcat | \n" + 
			
			"Location -> ID | NewExpr . ID | FinExpr [ Expr ]\n" + 
			
			"Literal -> INTEGER | STRING | true | false | null";
			
		public static final String LibicRules = 

			"S -> LibraryClass\n" + 
			
			"LibraryClass -> class CLASS_ID { LibMethodPump } \n" +
			
			"LibMethodPump -> LibMethod ; LibMethodPump | \n" + 
			
			"LibMethod -> static FunctionReturnType ID ( Formals ) \n " +
			
			"FunctionReturnType -> Type | void\n" + 
			
			"Formals -> Type ID TypeConcat | \n" + 
			
			"TypeConcat -> , Type ID TypeConcat | \n" +
			
			"Type -> int | boolean | string | CLASS_ID | Type [ ]";
}
